package com.zwan.oam_rtc.utils.messages;

import java.util.ArrayList;
import java.util.List;

/*(SDSMsgHead) + 请求消息结构*/
public class RtcmsResponseMerged {
    private int total=0;
    private int current=0;

    public List data = new ArrayList();

    public boolean MergeData(String newData, int newTotal, int newCurrent) {
        if(total==0) {
            total = newTotal;
        }
        else if(total != newTotal) {
            data.clear();
            data.add(0, "error total vulue when merge " + total + "<>" + newTotal);
            return true;
        }

        if(newCurrent > 10 || newTotal > 10) {
            data.clear();
            data.add (0,  "message too large?");
            return true;
        }

        data.add(newCurrent-1, newData);

        return data.size()==total;
    }
}
